Servlet Filter

This chapter will describe a sample servlet filter, that provides authentication and attribute retrieval using the Mellon2 API. The actual steps taken are identical to those for interactive authentication. Ticket-based SSO is not supported, and exceptions are not trapped (that is, they are thrown as ServletExceptions from the filter).

For more on servlet filters, please read this article.

Please note that this filter implementation has been designed to be as backwards compatible with the corresponding Mellon1 servlet filter as possible.

More information may be found in the servlet filter's JavaDoc.

Download

The Mellon2 Java client-side API contains both the Java API itself and the servlet filter.

Please refer to the Mellon2 API download section.

Configuration

A number of configuration properties are available for use with the Mellon2 servlet filter. Some of these are optional, while others are required.

A configuration property can be set using one of three methods.

  1. By defining it as a system property. This takes precedence over the two methods below.
  2. By setting it in the servlet filter's configuration. This takes precedence over the method below. Please refer to your servlet container's documentation for how to do this.
  3. By setting it in a configuration file. This file should be placed in the servlet's root folder; if your servlet container unpacks the servlet's WAR file in a folder CONTAINER_HOME/webapps/myservlet, the file should ble placed in CONTAINER_HOME/webapps/myservlet/WEB-INF/classes.

The following configuration properties are available for use with the Mellon2 servlet filter.

PropertyRequiredDescription
no.feide.mellon.serviceUsernameYesThe Moria2 service account's username.
no.feide.mellon.servicePasswordYesThe Moria2 service account's password.
no.feide.mellon.endpointYesThe SOAP v2.1 service endpoint of the Moria2 instance you are using. Please refer to this section for a list of service endpoints provided by FEIDE.
no.feide.mellon.requestedAttributesNoThe attributes to request from Moria2, as a comma-separated list.

With the exception of no.feide.mellon.endpoint, this list is identical to the Moria1 configuration properties.

Example /mellon.properties configuration file:

# The service credentials.
no.feide.mellon.serviceUsername=demo_service
no.feide.mellon.servicePassword=demo_service

# The attributes requested from Moria2.
no.feide.mellon.requestedAttributes=eduPersonAffiliation,eduPersonOrgDN

# The Moria2 service endpoint.
no.feide.mellon.endpoint=https://login.feide.no/moria2/v2_1/Authentication